package com.ebuy.shopping.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ebuy.shopping.mapper.NoticeMapper;
import com.ebuy.shopping.model.Notice;
@Service
public class NoticeService implements INoticeService {
	@Autowired
	private NoticeMapper noticeMapper;

	// 所有公告
	@Override
	public List<Notice> getNotices() {

		return noticeMapper.selectNoticeList();
	}
	// 一条公告
	@Override
	public Notice load(int id) {

		return noticeMapper.selectByPrimaryKey(id);
	}
	// 添加公告
	@Override
	public int add(Notice notice) {
		return noticeMapper.insertSelective(notice);
	}
	// 修改公告
	@Override
	public int update(Notice notice) {
		return noticeMapper.updateByPrimaryKeySelective(notice);
	}
	// 删除公告
	@Override
	public int delete(int id) {
		return noticeMapper.deleteByPrimaryKey(id);
	}

}
